package com.cskaoyan.user.controller;

import com.cskaoyan.mall.commons.result.ResponseData;
import com.cskaoyan.mall.commons.result.ResponseUtil;
import com.cskaoyan.user.constants.UserRetCode;
import com.cskaoyan.user.dto.UserVerifyRequest;
import com.cskaoyan.user.dto.UserVerifyResponse;
import com.cskaoyan.user.service.IVerifyService;
import org.aspectj.lang.annotation.Around;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 创建日期: 2022/05/19 20:11
 *
 * @author JinLu Zhou
 */
@RestController
@RequestMapping("/user")
public class VerifyController {

    @Autowired
    IVerifyService verifyService;

    @RequestMapping("/verify")
    public ResponseData verify(String uuid, String username) {
        UserVerifyRequest request = new UserVerifyRequest();
        request.setUuid(uuid);
        request.setUserName(username);
        UserVerifyResponse response = verifyService.verify(request);
        if(UserRetCode.SUCCESS.getCode().equals(response.getCode())){
            return new ResponseUtil<>().setData(null);
        }
        return new ResponseUtil().setErrorMsg(response.getMsg());
    }
}
